<?php
//------------------------------------------------------------------------------
// File view list for Thong tin dau tu
// Modification       :
//------------------------------------------------------------------------------
// Date(yyyy.mm.dd)   Developer                       Action
//------------------------------------------------------------------------------
// 2007.03.15         Oanhhtk                         Created
//------------------------------------------------------------------------------
function V_HomeList(&$arrayData){
    $ulr = "?".MODUL."=home&".ACTION."=";
	global $db;
	include_once(DIR_MODEL."md_san_pham.class.php");
	$objSanpham = new MD_Sanpham($db);
	$arrayData_Sanpham =  array();
?>
<?= CM_showError() ?> 

<table width="100%" cellpadding="0" cellspacing="0" border="0" style="padding-top:5px; ">
	<tr>
		<td valign="top"  colspan="4"><span class="name_product"><a href="#">Các sản phẩm nổi bật</a></span></td>
	</tr>
<?
if(!empty($arrayData)){
	$count=0;
		$i=0;
		$j= count($arrayData);
	foreach($arrayData as $row){
		$i+=1;
		if($count==0){
	 ?>
	 <tr>
	 <?
	 		}//ket thuc if($count==0)
	 ?>
	 	<td style="width:146px; border-right:1px solid #abdafd; <? if($j>4){?> border-bottom:1px solid #ccc; <? }?> <? if ($count==3){?> border-right:0px;<? } ?>">
			<div class="sanpham">
				<ul class="khungsp">
					<li class="blue1"><a href="?modul=sanpham&action=View&id_loai_sp=<?=$row['id_loai_sp']?>&id=<?=$row['id']?>" class="blue2"><?=$row['ten_sp']?></a>
					<?
					if($i<3){
					?>
					<img src="../images/new.gif"  width="30" height="15" />
					<?
					}
					?>
					</li>
					<li class="sp">
					<? 
						$Money = to_money($row['gia_sp']); 
						
						if($row['trang_thai']==1){
							$trang_thai ="Còn hàng";
						}else{
							$trang_thai = "Hết hàng";
						}
						$loai_tien = $row['loai_tien'];
						if($loai_tien==1){
							$cat_money = "VNĐ";
						}else{
							$cat_money = "USD";
						}
						$money_detail = "$Money $cat_money";
					 
					 
						$text = "<table cellpadding='0' cellspacing='0' width='300px' border=0><tr><td width='105px' align='left'  valign='top'><img src='".DIR_IMAGES_VIEW.$row['anh_sp']."' width='100px' height='100px' align='center' /></td><td valign=top align='left' width='195px'><table align=left cellpadding='0' cellspacing='0'><tr><td><font class=black>Giá bán: </font><font class=blue>".$money_detail."</font></td></tr><tr><td><font class='black'>Bảo hành: </font><font class=red>".$row['bao_hanh']." tháng</font></td></tr><tr><td><font class='black'>Nhà sản xuất: </font><font class=blue>".$row['nha_sx']."</font></td></tr><tr><td><font class='black'>Trạng thái: </font><font class=red>".$trang_thai."</font></td></tr></table></td></tr><tr><td colspan='2'  style='padding-top:10px; padding-left:5px; padding-right:5px; ' align=left><font class='black'><B>Chi tiết</B></font><div align='justify'>".$row['mo_ta_sp']."</div></td></tr></table>";
					?>
					<a href="?modul=sanpham&action=View&id_loai_sp=<?=$row['id_loai_sp']?>&id=<?=$row['id']?>">
						<img src="<?=DIR_IMAGES_VIEW.$row['anh_sp']?>" width="100px" height="100px" title="cssheader=[boxover-cssheader] cssbody=[boxover-cssbody] header=[<?=$row['ten_sp']?>] body=[<?=$text?>]" />
					</a>
					</li>
					<li class="blue"><font class="black">Giá:</font>&nbsp;<? $Money = to_money($row['gia_sp']); print("$Money $cat_money");?> </li>
					<li class="red"><font class="black">Bảo hành:</font>&nbsp;<?=$row['bao_hanh']?>&nbsp;tháng</li>
					<li class="blue"><font class="black">Nhà sản xuất:</font>&nbsp;<?=$row['nha_sx']?></li>
				</ul>
			</div><!-- sanpham -->
		</td>
	<?
		   $count+=1;
		   if($count>3){
		   $count=0;
		   $j-=4;
	?>
	 </tr>
	 
	 <?
	 	  }//ket thuc if($count>3)
			
		}//ket thuc foreach($arrayData as $row)
	?>
	<tr>
		<td colspan="4" style="padding-top:0px; margin:0px; ">
			<table width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td width="1%" valign="bottom" class="box_one">&nbsp;</td>
					<td valign="bottom" class="box_two">&nbsp;</td>
					<td width="1%" valign="bottom" class="box_three">&nbsp;</td>
				</tr>
			</table>
		</td>
		
	</tr>

<?
	
}//ket thuc if(!empty($arrayData))
?>
</table>
<?php
}//ket thuc ham
?>
